// mixin

mixin formInput ({label, name, placeholder, value = ''})
    .layui-form-item
        label.layui-form-label=label
        .layui-input-block
            input(type="text" name=name placeholder=placeholder autocomplete="off" class="layui-input" value=value)&attributes(
            attributes)

mixin formTextarea ({label, name, placeholder, value = ''})
    .layui-form-item
        label.layui-form-label=label
        .layui-input-block
            textarea(type="text" name=name placeholder=placeholder autocomplete="off" class="layui-textarea")&attributes(
            attributes)

mixin formSelect ({label, name, value, verify = '', options=[]})
    .layui-form-item
        label.layui-form-label=label
        .layui-input-block
            select(name=name lay-verify=verify value=value)&attributes(attributes)
                option(value="") 请选择分类
                each item in options
                    if item.selected
                        option(value=item.value selected)= item.name
                    else
                        option(value=item.value)= item.name

mixin formUpload ({id, label, name, value, placeholder='请选择上传路径', verify = ''})
    .layui-form-item
        label.layui-form-label=label
        .layui-input-block
            .file-upload(id=id)
                input(type="file" id="file" + name name=name placeholder=placeholder autocomplete="off" class="layui-input" value=value readonly)&attributes(
                attributes)
                .placeholder=placeholder
                .value
                .upload-select
                    label(for="file" + name).btn 上传图片
                    .upload-preview.btn
                        i.icon.layui-icon &#xe64a;
